﻿using System;
using System.Net;
using System.ComponentModel.DataAnnotations;
using SL8.SL;

namespace SuperLauncher.Entitys
{
    //Path="" Description="" Title="" ShowWindowState="" CommandLineArguments=""
    public class ItemInfo : ObservableObject
    {
        [Display(Description = "请输入应用程序完整路径", Name = "程序路径")]
        [Required(ErrorMessage = "程序路径不能为空")]
        public string Path
        {
            get
            {
                return this.GetCacheValue(o => o.Path, string.Empty);
            }

            set
            {
                this.SetCacheValueAndValidate(o => o.Path, value); 
            }
        }

        [Display(Description = "请输入简要描述", Name = "简要描述", Prompt = "C:\\...", GroupName = "A")]
        public string Description
        {
            get
            {
                return this.GetCacheValue(o => o.Description, string.Empty);
            }

            set
            {
                this.SetCacheValue(o => o.Description, value);
            }
        }

        [Display(Description = "请输入名称", Name = "程序名称")]
        [Required(ErrorMessage = "程序名称不能为空")]
        public string Title
        {
            get
            {
                return this.GetCacheValue(o => o.Title, string.Empty);
            }

            set
            {
                this.SetCacheValueAndValidate(o => o.Title, value); 
            }
        }

        [Display(Description = "请输入起始目录", Name = "起始目录")]
        public string StartDirectory
        {
            get
            {
                return this.GetCacheValue(o => o.StartDirectory, string.Empty);
            }

            set
            {
                this.SetCacheValueAndValidate(o => o.StartDirectory, value); 
            }
        }

        [Display(Description = "程序启动参数", Name = "启动参数")]
        public string CommandLineArguments
        {
            get
            {
                return this.GetCacheValue(o => o.CommandLineArguments, string.Empty);
            }

            set
            {
                this.SetCacheValue(o => o.CommandLineArguments, value);
            }
        }

        public int LaunchingItemID { get; set; }
    }
}
